package com.kmproject.haifu.mvp.ui.adapter;

import android.content.Intent;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.widget.alertview.AlertView;
import com.jess.arms.widget.alertview.AlertViewOnItemClickListener;
import com.kmproject.haifu.R;
import com.kmproject.haifu.mvp.model.entity.beans.HouseMainBean;
import com.kmproject.haifu.mvp.model.entity.beans.HousePayWayBean;
import com.kmproject.haifu.mvp.model.entity.beans.MemberCenterUserInfoBean;
import com.kmproject.haifu.mvp.model.entity.beans.MyStoryBean;
import com.kmproject.haifu.mvp.ui.activity.HousePublishDuanZuPublishActivity;
import com.kmproject.haifu.mvp.ui.activity.HousePublishOfficePublishActivity;
import com.kmproject.haifu.mvp.ui.activity.HousePublishStorePublishActivity;
import com.kmproject.haifu.mvp.ui.activity.MemberCenterUpdateLevelActivity;

import java.util.List;

public class HousePublishSelectTypeAdapter extends BaseQuickAdapter<HousePayWayBean, BaseViewHolder> {

    private ItemCallBack mitemCallBack;
    public HousePublishSelectTypeAdapter( @Nullable List<HousePayWayBean> data,ItemCallBack itemCallBack) {
        super(R.layout.housepublish_select_type_item, data);
       mitemCallBack=itemCallBack;
    }


    @Override
    protected void convert(BaseViewHolder helper, HousePayWayBean item) {
       helper.<TextView>getView(R.id.housepublish_select_type_item_title).setText(item.getName());
       helper.<RecyclerView>getView(R.id.housepublish_select_type_item_RecyclerView).setLayoutManager(new LinearLayoutManager(mContext));
        HousePublishSelectTypeItemAdapter adapter=   new HousePublishSelectTypeItemAdapter(item.getChildren());
        helper.<RecyclerView>getView(R.id.housepublish_select_type_item_RecyclerView).setAdapter(adapter);
        adapter.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                mitemCallBack.callBack(item,position);
            }
        });
    }

    public interface ItemCallBack{
        void callBack(HousePayWayBean parentHousePayWayBean, int childIndex);
    }
}
